<template>
  <el-form :inline="true" :model="formInline" class="demo-form-inline myForm">
    <el-form-item label="姓名">
      <el-input v-model="formInline.name" placeholder="专家姓名"></el-input>
    </el-form-item>
    <el-form-item label="邮箱">
      <el-input v-model="formInline.email" placeholder="专家邮箱"></el-input>
    </el-form-item>
    <el-form-item label="电话">
      <el-input v-model="formInline.phone" placeholder="专家电话"></el-input>
    </el-form-item>
    <el-form-item label="专家等级">
      <el-select v-model="formInline.level" placeholder="专家等级">
        <el-option label="等级一" value="等级一"></el-option>
        <el-option label="等级二" value="等级二"></el-option>
      </el-select>
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="onSubmit">查询</el-button>
    </el-form-item>
  </el-form>
</template>

<script>
import {mapActions} from "vuex";

export default {
  name: "ExpertSelectTools",
  data() {
    return {
      formInline: {
        name: '',
        level: '',
        email:'',
        phone:''
      }
    }
  },
  methods: {
    async onSubmit() {
      if (this.formInline.name.trim() === '' && this.formInline.level.trim() === ''
          && this.formInline.email.trim() === '' && this.formInline.phone.trim() === ''){
        this.$message.error("请输入查询内容")
      }else{
        await this.findExpert(this.formInline)
      }
    },
    ...mapActions('expert',['findExpert']),
  }
}
</script>

<style scoped>
  .myForm{
    text-align: right;
  }
</style>